Repository navigation
fix(nid): report failed library writes - #6906
Merged
Merged
Conversation
11 tasks done
Collaborator
|
Checked the stream-state fix in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The NID patcher reports
OKand exits 0 when a library write fails after opening the output. A valid 13,576-byte shared library restricted to a 1,024-byte output is truncated to 1,024 bytes while the tool reports success, allowing a build to continue with an incomplete library.Explicitly close the output stream and check its state before reporting success. Write or final flush failures now use the existing
FAILdiagnostic and exit status 2. File writes retain the current in-place behavior, so a failed write can still leave partial output.Tested
Linux x86-64, GCC/G++ 13.3, glibc 2.39, main
d9b696ddbb. Built the actualnid_patcherfrom all nine sources listed by its CMake target, with C++20 and O2. An unrestricted native GNU-hash shared library patches and returns 42 through its NID export. With a child-onlyRLIMIT_FSIZEand ignoredSIGXFSZ, unchanged main reports success after the short write.The registered native-path regression adds zero-byte and partial-write failure cases. Both fail against the unchanged actual tool and pass with the fix: exit 2, filename/error diagnostic, no success message. Existing Unicode paths, export-reference preservation and missing-input controls pass. All eight applicable NID Python test groups pass, and independent review reproduced the new red/green cases. The output-limit cases are POSIX-only; the stream-state fix is portable C++. Conventions and whitespace checks pass. No full-runtime or retail-title execution is claimed. The open-PR inventory and #6901's actual source contain no competing write-error fix.
Combined validation with #6904 also passes: both commits merge cleanly, the rebuilt actual tool passes all eight applicable NID groups, native SysV/dual-hash export lookup controls and zero/partial-write error controls.
Checklist
main; no other open PR implements the same fix.mdfiles or images added to the repository